<include file="public:head" />
<div class="layui-container fly-marginTop">
  <div class="fly-panel fly-panel-user" pad20>
    <div class="layui-tab layui-tab-brief" lay-filter="user">
      <ul class="layui-tab-title">
        <li><a href="{:U('user/login')}">登入</a></li>
        <li class="layui-this">注册</li>
      </ul>
      <div class="layui-form layui-tab-content" style="padding: 20px 0; min-height:500px">
        <div class="layui-tab-item layui-show">
          <div class="layui-form layui-form-pane">
            <form class="layui-form" method="post" >
                <input type="hidden" class="ins" name="iscaptcha" value="1" />
                <input type="hidden" name="refer" value="{$refer}"/>
                <input type="hidden" name="ret_url" value="{$ret_url}"/>
              <div class="layui-form-item">
                <label for="L_email" class="layui-form-label">用户名/邮箱</label>
                <div class="layui-input-inline">
                  <input type="text" class="layui-input" placeholder="请输入用户名" name="username"  >
                </div>
              </div>
              <div class="layui-form-item">
                <label for="L_pass" class="layui-form-label">邮箱</label>
                <div class="layui-input-inline">
                  <input type="text" class="layui-input" placeholder="请输入邮箱" name="email"  >
                </div>
              </div>
              <div class="layui-form-item">
                <label for="L_pass" class="layui-form-label">密码</label>
                <div class="layui-input-inline">
                  <input type="password" class="layui-input" placeholder="请输入密码" name="password"  >
                </div>
              </div>
              <div class="layui-form-item">
                <label for="L_pass" class="layui-form-label">重复密码</label>
                <div class="layui-input-inline">
                  <input type="password" class="layui-input" placeholder="重复密码" name="repassword"  >
                </div>
              </div>

               <div class="layui-form-item">
                <label for="L_pass" class="layui-form-label">图形码</label>
                <div class="layui-input-inline">
                  <input name="captcha" type="number" placeholder="图形码验证码" class="layui-input" id="form-field-3" value="">
                </div>
                <div class="layui-form-mid" style="padding: 0!important;"> <img style="height: 36px; width: 100px; cursor:pointer;" title="点击刷新验证码" src="{:U('common/code')}" class="verify_img" onclick="this.src='{:U('common/code')}&'+Math.random();"/> </div>
              </div>
             
              <div class="layui-form-item">
                <button class="layui-btn" id="regbtn">立即登录</button>
                <span style="padding-left:20px;">
                  <a href="forget.html">忘记密码？</a>
                </span>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script src="__PUBLIC__/theme/blueideal/layui/layui.js"></script> 
<script src="__PUBLIC__/theme/blueideal/layui/particles.min.js"></script> 
<script src="__PUBLIC__/theme/blueideal/layui/app.js"></script> 
<script type="text/javascript">
layui.use(['form', 'layer'], function () {
    // 操作对象
    var form = layui.form, layer = layui.layer, $ = layui.jquery;
    $('#regbtn').on('click',function(){
        var data = $("form").serialize();
        $.post("{:U('user/register')}",data,function(res){
            if (res.status.info == '验证码错误') {
              $(".verify_img").click();
            }
            if(res.status.status ==  1){
                layer.msg(res.status.info,{time:1800},function(){
                    location.href = "{$ret_url}";
                });
            }else{
                layer.msg(res.status.info,{time:1800});
            }
        });
        return false;
    }); 
})
</script>